/**
 */
package generalbookings.impl;

import generalbookings.BookedOptions;
import generalbookings.GeneralbookingsPackage;
import generalbookings.Option;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Option</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link generalbookings.impl.OptionImpl#getBooked <em>Booked</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OptionImpl extends NamedElementImpl implements Option {
	/**
	 * The cached value of the '{@link #getBooked() <em>Booked</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBooked()
	 * @generated
	 * @ordered
	 */
	protected BookedOptions booked;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OptionImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GeneralbookingsPackage.Literals.OPTION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BookedOptions getBooked() {
		if (booked != null && booked.eIsProxy()) {
			InternalEObject oldBooked = (InternalEObject)booked;
			booked = (BookedOptions)eResolveProxy(oldBooked);
			if (booked != oldBooked) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, GeneralbookingsPackage.OPTION__BOOKED, oldBooked, booked));
			}
		}
		return booked;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BookedOptions basicGetBooked() {
		return booked;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBooked(BookedOptions newBooked) {
		BookedOptions oldBooked = booked;
		booked = newBooked;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, GeneralbookingsPackage.OPTION__BOOKED, oldBooked, booked));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GeneralbookingsPackage.OPTION__BOOKED:
				if (resolve) return getBooked();
				return basicGetBooked();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GeneralbookingsPackage.OPTION__BOOKED:
				setBooked((BookedOptions)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GeneralbookingsPackage.OPTION__BOOKED:
				setBooked((BookedOptions)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GeneralbookingsPackage.OPTION__BOOKED:
				return booked != null;
		}
		return super.eIsSet(featureID);
	}

} //OptionImpl
